﻿using PhuLeBooze.UICode;
using PhuLeBussinessObject.Product;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace PhuLeBooze
{
    public partial class procuctdetail : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string html = "";
            string parten = "<div class=\"item {7}\">"
                  + "<img src=\"{0}\" />"
                  + "<div class=\"carousel-caption\">"
                     + " <h2 class=\"title\">{1}</h2>"
                      + "<div class=\"line\"></div>"
                      + "<br/>"
                      + "<center><img src=\"{2}\" /></center>"
                      + "<p>Xuất xứ: {3}</p>"
                      + "<div class=\"line\"></div>"
                      + "<p>Quy cách: {4}</p>"
                      + "<div class=\"line\"></div>"
                      + "<p>Giá bán: <span class=\"price\">{5}</span></p>"
                      + "<p class=\"des\">"
                      + " {6}</p>"
                      + "<h2 class=\"title ct\">Liên hệ mua hàng - Hotline: <span>{8}</span></h2>"
                        + "</div>"
                        + "</div>";
            string produtTypeID = "0";

            if (Page.RouteData.Values["id"] != null)
                produtTypeID = Page.RouteData.Values["id"].ToString();


            if (Request.QueryString["id"] != null)
                produtTypeID = Request.QueryString["id"].ToString();

            string ltrImgText = "";
            string ltGenericText = "";
            CProductTypeUI UI = new CProductTypeUI();
            CProductType Item = UI.GetProductTypeDetail(produtTypeID);
            if (Item != null)
            {
                if (Item.Image1 != "")
                {
                    ltrImgText += string.Format(" <div class='item {1}'><img src='{0}' /></div>", Item.Image1, "active");//Item.NameVN, Item.Logo, Item.Origin, Item.Specification, Item.Price, Item.DescriptionVN, CConfigSiteEntity.ContactPurchases
                    ltGenericText += "<li data-target='#carousel-example-generic' data-slide-to='0' class='active'></li>";
                }
                if (Item.Image2 != "")
                {
                    ltrImgText += string.Format(" <div class='item {1}'><img src='{0}' /></div>", Item.Image2, "");
                    ltGenericText += "<li data-target='#carousel-example-generic' data-slide-to='1' ></li>";
                }
                if (Item.Image3 != "")
                {
                    ltrImgText += string.Format(" <div class='item {1}'><img src='{0}' /></div>", Item.Image3, "");
                    ltGenericText += "<li data-target='#carousel-example-generic' data-slide-to='3' ></li>";
                }
                if (Item.Image4 != "")
                {
                    ltrImgText += string.Format(" <div class='item {1}'><img src='{0}' /></div>", Item.Image4, "");
                    ltGenericText += "<li data-target='#carousel-example-generic' data-slide-to='4' ></li>";
                }
            }
            ltrImg.Text = ltrImgText;
            ltrName.Text = Item.NameVN;
            ltrLogo.Text = string.Format("<img src='{0}' />", Item.Logo);
            ltrOrigin.Text = Item.Origin;
            ltrSpecification.Text = Item.Specification;
            ltrPrice.Text = Item.Price;
            ltrDescription.Text = Item.DescriptionVN;
            ltrContactPurchases.Text = CConfigSiteEntity.ContactPurchases;
            ltrGeneric.Text = ltGenericText;
            //  ltrDetail.Text = html;
        }
    }
}